﻿@{
    //super simple login page
    //just to provide basic protection for control panel
    Validation.RequireField("uName", "Required field");
    Validation.RequireField("uPwd","Required field");

    if (IsPost && Validation.IsValid()){

        var un = Request["uName"];
        var up = Request["uPwd"];
        
    
        var db = Database.Open("razorC");
        var sqlSelect = "Select * from rc_Login where rcUser=@0 and rcPwd=@1";
        var data = db.QuerySingle (sqlSelect, un, up);
        
        if (data!=null)
        {
            FormsAuthentication.RedirectFromLoginPage(un, false);
        
        }
        
    }
    
    
    }
<!DOCTYPE html>
<html>
    <head>
        <title>razorC.net - login page</title>
        <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.0.3.js"></script>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.3/jquery-ui.js"></script>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.js"></script>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/mvc/4.0/jquery.validate.unobtrusive.js"></script>
    <link type="text/css" rel="Stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.3/themes/black-tie/jquery-ui.css" />
    <link href="~/rcAdmin/css/rcCP.css" rel="stylesheet" />
        
    </head>
    <body>

         <div id="page">
        <div id="menu">
          <a href="~/Default" class="top">Your Site</a>
        </div>
        <div id="content">
            <form method="post" action="">
 <fieldset>
        <legend>Login</legend>
        <ol>
            <li >
                <label for="uName">User:</label>
                <input type="text" name="uName" @Validation.For("uName") id="uName" value="" maxlength="50" /> @Html.ValidationMessage("uName")
                </li>
                <li>
                <label for="uPwd">Password:</label>
                <input type="password" name="uPwd" @Validation.For("uPwd") id="uPwd" value="" /> @Html.ValidationMessage("uPwd")
            </li>
        </ol>
          <p class="form-actions">
            <input type="submit" value="Login" title="Login" />
        </p>
</fieldset>
</form>
        </div>
    </div>


        
    </body>
</html>
